package com.taugin.joyhappy.activity;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.FrameLayout;
import android.widget.Toast;

import com.taugin.joyhappy.R;
import com.taugin.joyhappy.base.BaseActivity;
import com.taugin.joyhappy.fragment.BlankFragment;
import com.zhy.changeskin.SkinManager;
import com.zhy.changeskin.base.BaseSkinActivity;


public class MainActivity extends BaseActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getSupportFragmentManager().beginTransaction().add(R.id.fragment, new BlankFragment()).commitAllowingStateLoss();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        menu.add(0, 0, 0, "白天");
        menu.add(0, 1, 0, "夜晚");
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch(item.getItemId()) {
            case 0:
                SkinManager.getInstance().changeSkin("day");
                break;
            case 1:
                SkinManager.getInstance().changeSkin("night");
                break;
            default:
                break;
        }
        Toast.makeText(this, item.getTitle(), Toast.LENGTH_SHORT).show();
        return super.onOptionsItemSelected(item);
    }
}
